from kivy.app import App
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.button import Button


class MyApp(App):
    def build(self):
        self.sm = ScreenManager()
        mp = FloatLayout()
        main_button = Button(text='main', size_hint=(.1, .1))
        main_button.bind(on_press=self.press_main_button)
        mp.add_widget(main_button)
        screen = Screen(name='mp')
        screen.add_widget(mp)
        self.sm.add_widget(screen)
        screen2 = Screen(name='2')
        sp = FloatLayout()
        button2 = Button(text='2', size_hint=(.1, .1), pos_hint={'x': .2, 'y': .2})
        button2.bind(on_press=self.press_button2)
        sp.add_widget(button2)
        screen2.add_widget(sp)
        self.sm.add_widget(screen2)
        return self.sm

    def press_main_button(self, instance):
        self.sm.current = '2'

    def press_button2(self, instance):
        self.sm.current = 'mp'


if __name__ == '__main__':
    MyApp().run()
